layui.use(['form', 'layer', 'jquery'], function (data) {
    var form = layui.form,
        $ = layui.jquery,
        layer = layui.layer;


    form.on('submit(addSupplementMaterial)', function (data) {
        var formData = data.field;
        var url = ctx + "/production/addSupplementMaterial"
        var index = top.layer.msg("数据提交中，请稍后", {
            icon: 16, // 图标
            time: true,  // 不关闭
            shade: 0.8 // 设置遮罩透明度
        });
         console.log(formData)
        $.ajax({
            type: "post",
            url: url,
            data: formData,
            success: function (data) {
                if (data.code == 200) {
                    layer.msg(data.msg , {time: 1000});
                    layer.close(index);
                    $("#supplement")[0].reset();
                }
            },
            error: function (data) {
                layer.msg(data.msg);
                layer.close(index);
            }


        })
        return false;
    })


})